
const {uploadFiles}=require('../until/hanleFiles');
function uploadImages(req,res,next){
    const uploadImages=uploadFiles({
        dir:'./public/images',//图片在服务器中的存储路径
        key:'file', //跟前端fd.append('file',files[0])中的file匹配
        size:3000, //图片最大限制，单位kb
    });
    uploadImages(req,res,err=>{
        if(err){
            console.log('图片上传失败',err);
        }else{
            console.log('图片上传成功',req.files);
            res.send({
                message:'图片上传成功',
                code:200,
                data: '../images/' + req.files[0].filename
            });
        }
        
    });
}

module.exports = {uploadImages}